'use strict';

goog.provide('Blockly.Blocks.inout');

goog.require('Blockly.Blocks');
goog.require('Blockly.Colours');
goog.require('Blockly.constants');
goog.require('Blockly.ScratchBlocks.VerticalExtensions');


Blockly.Blocks['inout_highlow'] = {
  init: function() {
    this.jsonInit({
        "type": "inout_highlow",
        "message0": "%1",
        "args0": [
          {
            "type": "field_dropdown",
            "name": "text_values",
            "options": [
              [
                "%{BKY_INOUT_HIGH_MSG}",
                "HIGH"
              ],
              [
                "%{BKY_INOUT_LOW_MSG}",
                "LOW"
              ]
            ]
          }
        ],
        "output": "String",
        "extensions": ["colours_more", "output_string"]
      });
  }
};


Blockly.Blocks['inout_digital_pin'] = {
  init: function() {
    this.jsonInit({
        "type": "inout_digital_pin",
        "message0": "%1",
        "args0": [
          {
            "type": "field_dropdown",
            "name": "d_pin_values",
            "options": profile.default.digital
          }
        ],
        "output": "Number",
        "extensions": ["colours_more", "output_number"]
      });
  }
};


Blockly.Blocks['inout_analog_pin'] = {
  init: function() {
    this.jsonInit({
        "type": "inout_digital_pin",
        "message0": "%1",
        "args0": [
          {
            "type": "field_dropdown",
            "name": "a_pin_values",
            "options": profile.default.analog
          }
        ],
        "output": "String",
        "extensions": ["colours_more", "output_string"]
      });
  }
};


Blockly.Blocks['inout_digital_write'] = {
  init: function() {
    this.jsonInit({
      "type": "inout_digital_write",
      "message0": "%{BKY_INOUT_DIGITAL_WRITE_MSG}",
      "args0": [
        {
          "type": "input_value",
          "name": "pin",
          "check": "Number"
        },
        {
          "type": "input_value",
          "name": "p_value",
          "check": "String"
        }
      ],
      "inputsInline": true,
      "previousStatement": null,
      "nextStatement": null,
      "extensions": ["colours_more", "shape_statement"]
    });
  }
};


Blockly.Blocks['inout_digital_read'] = {
  init: function() {
    this.jsonInit({
      "type": "inout_digital_read",
      "message0": "%{BKY_INOUT_DIGITAL_READ_MSG}",
      "args0": [
        {
          "type": "input_value",
          "name": "pin",
          "check": "Number"
        }
      ],
      "inputsInline": true,
      "output": "Number",
      "extensions": ["colours_more", "output_number"]
    });
  }
};


Blockly.Blocks['inout_analog_write'] = {
  init: function() {
    this.jsonInit({
      "type": "inout_analog_write",
      "message0": "%{BKY_INOUT_ANALOG_WRITE_MSG}",
      "args0": [
        {
          "type": "input_value",
          "name": "pin",
          "check": "String"
        },
        {
          "type": "input_value",
          "name": "p_value",
          "check": "Number"
        }
      ],
      "inputsInline": true,
      "previousStatement": null,
      "nextStatement": null,
      "extensions": ["colours_more", "shape_statement"]
    });
  }
};


Blockly.Blocks['inout_analog_read'] = {
  init: function() {
    this.jsonInit({
      "type": "inout_analog_read",
      "message0": "%{BKY_INOUT_ANALOG_READ_MSG}",
      "args0": [
        {
          "type": "input_value",
          "name": "pin",
          "check": "String"
        }
      ],
      "inputsInline": true,
      "output": "Number",
      "extensions": ["colours_more", "output_number"]
    });
  }
};
